const generatePassword = (len) => {
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()';
  let pwd = '';
  for (let i=0; i < len; i++) {
    const randomNum = Math.floor(Math.random() * chars.length);
    pwd += chars[randomNum];
  }
  return pwd;
}


const password = generatePassword(5);
console.log('Generated password: ' + password);